﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Demo.Migrations;

/// <inheritdoc />
public partial class Update_Abp_7 : Migration
{
    /// <inheritdoc />
    protected override void Up(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.CreateTable(
            name: "AbpFeatureGroups",
            columns: table => new
            {
                Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
            },
            constraints: table => table.PrimaryKey("PK_AbpFeatureGroups", x => x.Id));

        migrationBuilder.CreateTable(
            name: "AbpFeatures",
            columns: table => new
            {
                Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                ParentName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                Description = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                DefaultValue = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                IsVisibleToClients = table.Column<bool>(type: "bit", nullable: false),
                IsAvailableToHost = table.Column<bool>(type: "bit", nullable: false),
                AllowedProviders = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                ValueType = table.Column<string>(type: "nvarchar(2048)", maxLength: 2048, nullable: true),
                ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
            },
            constraints: table => table.PrimaryKey("PK_AbpFeatures", x => x.Id));

        migrationBuilder.CreateTable(
            name: "AbpPermissionGroups",
            columns: table => new
            {
                Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
            },
            constraints: table => table.PrimaryKey("PK_AbpPermissionGroups", x => x.Id));

        migrationBuilder.CreateTable(
            name: "AbpPermissions",
            columns: table => new
            {
                Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
                GroupName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
                ParentName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                DisplayName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: false),
                IsEnabled = table.Column<bool>(type: "bit", nullable: false),
                MultiTenancySide = table.Column<byte>(type: "tinyint", nullable: false),
                Providers = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: true),
                StateCheckers = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
                ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true)
            },
            constraints: table => table.PrimaryKey("PK_AbpPermissions", x => x.Id));

        migrationBuilder.CreateIndex(
            name: "IX_AbpFeatureGroups_Name",
            table: "AbpFeatureGroups",
            column: "Name",
            unique: true);

        migrationBuilder.CreateIndex(
            name: "IX_AbpFeatures_GroupName",
            table: "AbpFeatures",
            column: "GroupName");

        migrationBuilder.CreateIndex(
            name: "IX_AbpFeatures_Name",
            table: "AbpFeatures",
            column: "Name",
            unique: true);

        migrationBuilder.CreateIndex(
            name: "IX_AbpPermissionGroups_Name",
            table: "AbpPermissionGroups",
            column: "Name",
            unique: true);

        migrationBuilder.CreateIndex(
            name: "IX_AbpPermissions_GroupName",
            table: "AbpPermissions",
            column: "GroupName");

        migrationBuilder.CreateIndex(
            name: "IX_AbpPermissions_Name",
            table: "AbpPermissions",
            column: "Name",
            unique: true);
    }

    /// <inheritdoc />
    protected override void Down(MigrationBuilder migrationBuilder)
    {
        migrationBuilder.DropTable(
            name: "AbpFeatureGroups");

        migrationBuilder.DropTable(
            name: "AbpFeatures");

        migrationBuilder.DropTable(
            name: "AbpPermissionGroups");

        migrationBuilder.DropTable(
            name: "AbpPermissions");
    }
}
